import { createBrowserRouter, redirect } from "react-router-dom";
import Layout from "../layout";

const router = createBrowserRouter([
  {
    path: "/",
    element: <Layout />,
    children: [
      {
        index: true, // 等价于 path: ""
        loader: () => redirect("/home"),
      },
      {
        path: "home",
        element: <div id="container" />,
      },
      {
        path: "home1",
        element: <div id="container" />,
        children: [
          {
            path: "child1", // 👈 不要加 "/"
            element: <div id="container" />,
          },
        ],
      },
      {
        path: "vue/*",
        element: <div id="container" />,
      },
      {
        path: "react/*",
        element: <div id="container" />,
      },
    ],
  },
]);

export default router;
